<?php
//
defined('BY_JYA') or exit('error');
$_RQ['op']=$_RQ['op']?$_RQ['op']:'main';
if($_RQ['op']=='main'){
	$return=array();
	exi($return);
}
if($_RQ['op']=='gettanmus'){
	$params=array('uniacid'=>$_SESSION['uniacid'],'status'=>1);
	$pindex = max(1, intval($_RQ['page']));
	$psize = 30;
	$total='';
	$fields=array('id','mid','status');
	$list=pdo_getslice('jy_ailiao_msglog',$params,array($pindex,$psize),$total,$fields,'','createtime desc');
	foreach($list as &$item){
		$member=cfc('core')->member_show($item['mid']);
		$member['nickname']=mb_substr($member['nickname'],0,4,'utf-8').'***';
		$item['nickname']=$member['nickname'];
		$member['avatar']=$member['avatar']?:'../core/resource/images/nopic.jpg';
		$item['avatar']=tomedia($member['avatar']);
	}
	$return['list']=$list;
	exi($return);
}
if($_RQ['op']=='getvideocall'){
	if($_SESSION['uid']){
		$videocall=pdo_get('jy_ailiao_tcp',array('mid OR'=>'mid='.$_SESSION['uid'].' or tomid='.$_SESSION['uid'],'tocalltime >'=>time()-600,'uniacid'=>$_SESSION['uniacid'],'status'=>1,'callmid <>'=>$_SESSION['uid']));
		$videocall['tomid']=$videocall['mid']==$_SESSION['uid']?$videocall['tomid']:$videocall['mid'];
		$member=model('core/member')->detail($videocall['tomid']);
		$videocall['nickname']=$member['nickname']?:$member['username'];
	}
	$return['videocall']=$videocall;
	exi($return);
}
?>